﻿@model Pku.BookStore.Model.ProductModel
@{
    Layout = "~/Views/Shared/_AdminLayout.cshtml";
    ViewBag.Title = "图书信息详情-后台管理";
}
<link href="/Content/user.self.css" rel="stylesheet" type="text/css" />
<div class="right">
    <div class="o-mt">
        <h2>
            图书信息详情</h2>
    </div>
    <div class="m" id="baseinfo">
        <div class="mc">
            <div class="i-m">
                <div class="i-mc">
                    @using (Html.BeginForm())
                    {
                        <div class="form">
                            <div class="item">
                                <span class="label">图书ID：</span>
                                <div class="fl">
                                    @Model.BookID.ToString()
                                </div>
                                <div class="clr">
                                </div>
                            </div>
                            <div class="item">
                                <span class="label"><em>*</em>ISBN：</span>
                                <div class="fl">
                                    <div>
                                        @Html.TextBox("ISBN", Model.ISBN, new { @class = "text" })
                                    </div>
                                </div>
                                <div class="clr">
                                </div>
                            </div>
                            <div class="item">
                                <span class="label"><em>*</em>图书名称：</span>
                                <div class="fl">
                                    <div>
                                        @Html.TextBox("BookName", Model.BookName, new { @class = "text" })
                                    </div>
                                </div>
                                <div class="clr">
                                </div>
                            </div>
                            <div class="item">
                                <span class="label"><em>*</em>作者：</span>
                                <div class="fl">
                                    <div>
                                        @Html.TextBox("Author", Model.Author, new { @class = "text" })
                                    </div>
                                </div>
                                <div class="clr">
                                </div>
                            </div>
                            <div class="item">
                                <span class="label"><em>*</em>出片社名称：</span>
                                <div class="fl">
                                    <div>
                                        @Html.DropDownList("PublisherID", (List<SelectListItem>)ViewBag.publisherList, Model.PublisherName, new { @style = "width: 150px;" })
                                    </div>
                                </div>
                                <div class="clr">
                                </div>
                            </div>
                            <div class="item">
                                <span class="label"><em>*</em>出版时间：</span>
                                <div class="fl">
                                    <div>
                                        @Html.TextBox("PublishDate", Model.PublishDate.ToString("yyyy-MM-dd"), new { @class = "text" })
                                    </div>
                                </div>
                                <div class="clr">
                                </div>
                            </div>
                            <div class="item">
                                <span class="label"><em>*</em>分类：</span>
                                <div class="fl">
                                    <div>
                                        @Html.DropDownList("CategoryIDF", (List<SelectListItem>)ViewBag.firstCateList, "--请选择--", new { @style = "width: 150px;" })
                                        @Html.DropDownList("CategoryID", (List<SelectListItem>)ViewBag.CateList, @Model.CategoryName, new { @style = "width: 150px; margin-left:10px" })
                                    </div>
                                </div>
                                <div class="clr">
                                </div>
                            </div>
                            <div class="item">
                                <span class="label"><em>*</em>价格：</span>
                                <div class="fl">
                                    @Html.Label("成本价：") @Html.TextBox("CostPrice", Model.CostPrice, new { @class = "text", style = "width:50px" })
                                    @Html.Label("原价：") @Html.TextBox("Price", Model.Price, new { @class = "text", style = "width:50px" })
                                    @Html.Label("售价：") @Html.TextBox("TruePrice", Model.TruePrice, new { @class = "text", style = "width:50px" })
                                    @Html.Label("是否特价：")
                                    @Html.RadioButton("isSpecial", "0", Model.isSpecial == 0)<label>否</label>
                                    @Html.RadioButton("isSpecial", "1", Model.isSpecial == 1)<label>是</label>
                                </div>
                                <div class="clr">
                                </div>
                            </div>
                            <div class="item">
                                <span class="label"><em>*</em>推荐：</span>
                                <div class="fl">
                                    <div>
                                        @Html.TextArea("Recommend", Model.Recommend, new { @rows = "5", cols = "90" })
                                    </div>
                                </div>
                                <div class="clr">
                                </div>
                            </div>
                            <div class="item">
                                <span class="label"><em>*</em>简介：</span>
                                <div class="fl">
                                    <div>
                                        @Html.TextArea("Introduction", Model.Introduction, new { @rows = "5", cols = "90" })
                                    </div>
                                </div>
                                <div class="clr">
                                </div>
                            </div>
                            <div class="item">
                                <span class="label"><em>*</em>目录：</span>
                                <div class="fl">
                                    <div>
                                        @Html.TextArea("Directory", Model.Directory, new { @rows = "5", cols = "90" })
                                    </div>
                                </div>
                                <div class="clr">
                                </div>
                            </div>
                            <div class="item">
                                <span class="label"><em>*</em>录入日期：</span>
                                <div class="fl">
                                    <div>
                                        @Html.Label(Model.AddDate.ToString())
                                    </div>
                                </div>
                                <div class="clr">
                                </div>
                            </div>
                            <div class="item">
                                <span class="label">&nbsp;</span>
                                <div class="fl">
                                    @{
                        if (Model.BookID != 0)
                        {
                                        @Html.TextBox("Act", "E", new { @style = "display:none" })
                        }
                        else
                        { 
                                        @Html.TextBox("Act", "A", new { @style = "display:none" })
                        }
                                    }
                                    <input id="submitBtn" type="image" src="@Url.Content("~/images/btn_sub.gif")"  onclick="return btnClick();" style=" margin-right:80px" />
                                </div>
                                <div class="clr">
                                </div>
                            </div>
                            <div class="item">
                                <span class="label">&nbsp;</span>
                                <div class="fl">
                                    @Html.ValidationMessage("Info")
                                </div>
                                <div class="clr">
                                </div>
                            </div>
                        </div>
                    }
                </div>
            </div>
        </div>
        @{
            if (Model.BookID != 0)
            {
            <div class="mc">
                <div class="i-m">
                    <div class="i-mc">
                        @using (Html.BeginForm("ProductEdit", "Admin", FormMethod.Post, new { enctype = "multipart/form-data" }))
                        {
                            <div class="form">
                                <div class="item">
                                    <span class="label">封面图片：</span>
                                    <div class="fl">
                                        <img src="@Model.Image"  width="80"/><br />
                                        <br />
                                        @Html.Label("选择上传文件：")<input name="file" type="file" id="file" /><input type="submit"
                                            name="Upload" value="上传" />
                                    </div>
                                    <div class="clr">
                                    </div>
                                </div>
                                <div class="item">
                                    <span class="label">&nbsp;</span>
                                    @Html.TextBox("Act", "U", new { @style = "display:none" })
                                    <div class="fl">
                                        <input id="submitBtn1" type="image" src="@Url.Content("~/images/btn_sub.gif")"  onclick="return btnClick();" style=" margin-right:80px" />
                                    </div>
                                    <div class="clr">
                                    </div>
                                </div>
                                <div class="item">
                                    <span class="label">&nbsp;</span>
                                    <div class="fl">
                                        @Html.ValidationMessage("Info1")
                                    </div>
                                    <div class="clr">
                                    </div>
                                </div>
                            </div>
                        }
                    </div>
                </div>
            </div>
            }
        }
    </div>
</div>
<script type="text/javascript">
    $(document).ready(function () {
        $("#CategoryIDF").change(function () {
            var url = "/Admin/GetCategoryJson?Level=2&pCatid=" + $("#CategoryIDF").val(); //规则是控制器/方法/参数
            $.getJSON(url, function (data) {
                $('#CategoryID').html('');
                $.each(data, function (i, item) {
                    $('#CategoryID').append($("<option></option>").val(item.CategoryID).html(item.CategoryName));
                });
            });
        });
    });
</script>
